Skip to content

feat(theme): modular CSS, light/dark/auto theme system (Phase 1 - Foundation PR 1)#377

Open
vitorvasc wants to merge 46 commits intoopen-telemetry:mainfrom
vitorvasc:feat/84-pr1-theme-system
Open

feat(theme): modular CSS, light/dark/auto theme system (Phase 1 - Foundation PR 1)#377
vitorvasc wants to merge 46 commits intoopen-telemetry:mainfrom
vitorvasc:feat/84-pr1-theme-system

Conversation

@vitorvasc
Copy link
Copy Markdown
Member

@vitorvasc vitorvasc commented May 6, 2026

Part of the Phase 1 foundation work for the explorer redesign (#84).

Contributes to #370.

What's in this PR

  • Splits src/index.css into focused partials under src/styles/:
    • tokens.css — all CSS custom properties (dark + new light theme block)
    • base.css — global resets and body defaults
    • syntax.css — code block / syntax highlight rules
    • index.css — entry point that @imports the partials
  • The monolithic file is removed; src/main.tsx now imports from src/styles/index.css.
  • Replaces the old { themeId, setThemeId } API with a cleaner { mode, resolved, setMode } shape:
    • mode — the user's stored preference: "light" | "dark" | "auto"
    • resolved — the value actually applied to the document ("light" | "dark")
    • setMode — writes to localStorage["td-color-theme"] and updates [data-theme] on <html>
  • Adds an inline <script> in index.html that runs before first paint, reads localStorage["td-color-theme"], and sets [data-theme] on <html>. Prevents the white flash users see on dark-preferred systems before React hydrates.
  • Adds a [data-theme="light"] block in tokens.css alongside the existing dark defaults. Reconciles the five remaining dark surface tokens (card, muted, border, and variants) to the navy palette.
  • Authors the <ThemeToggle /> component (cycles light → dark → auto). Not yet rendered.
  • Migrates remaining literal-hue usages to brand primitives following the primary = blue / secondary = orange realignment already on main

⚠️ Production-visible changes (no V1_REDESIGNgate):

  • Five dark-mode surface tokens (card, card-secondary, muted, muted-foreground, border) shift to the navy palette on merge.

What's not in this PR

  • The toggle is not visible yet. It mounts in PR 2 alongside the new NavBar.
  • Light theme colors are plumbed but the page-level design (hero, cards, etc.) stays unchanged until later PRs activate V1_REDESIGN in App.tsx.
  • No changes to the feature-flag system or routing.

Verification

  • bun run test — 781 tests pass
  • tsc -b — clean
  • Theme init: open DevTools → Application → Local Storage. Toggle the control and confirm td-color-theme updates. Reload; confirm the selected theme is applied before React loads (no flash).
  • Auto mode: change OS color scheme with the toggle set to auto; confirm the page updates without a reload.

Co-authored with Claude Opus 4.7. Reviewed with Gemini 3 (see the comment).

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
…ve documentation

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
…n themes.ts

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
…tence and auto mode

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
…cript to head

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
… documents

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
@jaydeluca jaydeluca closed this May 7, 2026
@jaydeluca jaydeluca reopened this May 7, 2026
@vitorvasc vitorvasc force-pushed the feat/84-pr1-theme-system branch from eca689d to 1bb6c52 Compare May 8, 2026 21:48
@vitorvasc vitorvasc mentioned this pull request May 11, 2026
9 tasks
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
@otelbot
Copy link
Copy Markdown
Contributor

otelbot Bot commented May 11, 2026

PR Screenshots

Home

Light

Desktop Tablet Mobile
home desktop light home tablet light home mobile light

Dark

Desktop Tablet Mobile
home desktop dark home tablet dark home mobile dark
Instrumentation List

Light

Desktop Tablet Mobile
instrumentation-list desktop light instrumentation-list tablet light instrumentation-list mobile light

Dark

Desktop Tablet Mobile
instrumentation-list desktop dark instrumentation-list tablet dark instrumentation-list mobile dark
Detail — Details tab

Light

Desktop Tablet Mobile
detail-details desktop light detail-details tablet light detail-details mobile light

Dark

Desktop Tablet Mobile
detail-details desktop dark detail-details tablet dark detail-details mobile dark
Detail — Telemetry tab

Light

Desktop Tablet Mobile
detail-telemetry desktop light detail-telemetry tablet light detail-telemetry mobile light

Dark

Desktop Tablet Mobile
detail-telemetry desktop dark detail-telemetry tablet dark detail-telemetry mobile dark
Detail — Configuration tab

Light

Desktop Tablet Mobile
detail-configuration desktop light detail-configuration tablet light detail-configuration mobile light

Dark

Desktop Tablet Mobile
detail-configuration desktop dark detail-configuration tablet dark detail-configuration mobile dark
Collector List

Light

Desktop Tablet Mobile
collector-list desktop light collector-list tablet light collector-list mobile light

Dark

Desktop Tablet Mobile
collector-list desktop dark collector-list tablet dark collector-list mobile dark
Collector Detail

Light

Desktop Tablet Mobile
collector-detail desktop light collector-detail tablet light collector-detail mobile light

Dark

Desktop Tablet Mobile
collector-detail desktop dark collector-detail tablet dark collector-detail mobile dark

Captured from f5f0156 on feat/84-pr1-theme-system · workflow run· 2026-05-11 15:01 UTC

vitorvasc added 2 commits May 11, 2026 08:23
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
@vitorvasc vitorvasc marked this pull request as ready for review May 11, 2026 11:24
@vitorvasc vitorvasc requested review from a team as code owners May 11, 2026 11:24
@vitorvasc vitorvasc requested a review from Copilot May 11, 2026 11:24
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR lays the groundwork for the Explorer redesign theme system by modularizing global CSS, introducing a light/dark/auto theme mode API with persistence and pre-hydration initialization, and aligning remaining UI accents with the updated brand primitives.

Changes:

  • Split the monolithic src/index.css into src/styles/ partials and update the app entry import accordingly.
  • Replace the old theme API with { mode, resolved, setMode }, add localStorage["td-color-theme"] persistence, and add an early index.html script to set data-theme before first paint.
  • Migrate remaining hard-coded/inline color usages to otel-* primitives and primary/secondary role tokens across multiple UI areas, plus update the screenshot script to capture both light and dark.

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
projects/84-ui-ux-design/NEXT-STEPS.md Updates the redesign roadmap/status notes and Phase 1 PR tracking.
projects/84-ui-ux-design/00-foundation-audit.md Updates audit checklist text to reflect the current state of V1_REDESIGN and PR 1 scope.
ecosystem-explorer/src/themes.ts Reworks theme metadata to light/dark resolved themes and updates defaults.
ecosystem-explorer/src/themes.test.ts Adds tests asserting the new theme record shape and default.
ecosystem-explorer/src/theme-context.tsx Replaces theme context API with mode/resolved, persistence, and system-mode subscription.
ecosystem-explorer/src/theme-context.test.tsx Updates tests to cover persistence, auto resolution, and matchMedia reactivity.
ecosystem-explorer/src/styles/tokens.css Introduces tokenized theme variables with explicit [data-theme="dark"] and [data-theme="light"] blocks.
ecosystem-explorer/src/styles/base.css Moves global resets/body defaults into a dedicated stylesheet.
ecosystem-explorer/src/styles/syntax.css Moves YAML/syntax highlight classes into a dedicated stylesheet.
ecosystem-explorer/src/styles/index.css Creates the Tailwind + partial import entry point and defines Tailwind @theme mappings.
ecosystem-explorer/src/main.tsx Switches the global CSS import to the new src/styles/index.css entry point.
ecosystem-explorer/src/index.css Removes the previous monolithic stylesheet.
ecosystem-explorer/src/features/not-found/not-found-page.tsx Adjusts button/link accent styling to the updated semantic tokens.
ecosystem-explorer/src/features/java-agent/java-release-comparison-page.tsx Updates gradients and “under development” accents to new brand primitives/tokens.
ecosystem-explorer/src/features/java-agent/java-instrumentation-list-page.tsx Updates title gradient classes to use brand primitives.
ecosystem-explorer/src/features/java-agent/java-configuration-list-page.tsx Updates title gradient classes to use brand primitives.
ecosystem-explorer/src/features/java-agent/java-agent-page.tsx Updates title gradient classes to use brand primitives.
ecosystem-explorer/src/features/java-agent/instrumentation-detail-page.tsx Updates loading/ornament gradients and accent colors to brand primitives and secondary tokens.
ecosystem-explorer/src/features/java-agent/configuration/configuration-builder-page.tsx Updates title gradient classes to use brand primitives.
ecosystem-explorer/src/features/java-agent/components/sub-instrumentation-item.tsx Updates list item border/hover accent styling to updated semantic tokens.
ecosystem-explorer/src/features/java-agent/components/multi-instrumentation-group-card.tsx Updates hover shadow and badge accent colors to updated primitives/tokens.
ecosystem-explorer/src/features/java-agent/components/instrumentation-filter-bar.tsx Updates radial gradient ornament fills to use brand primitives.
ecosystem-explorer/src/features/java-agent/components/instrumentation-card.tsx Updates hover border/shadow accents to use updated primitives/tokens.
ecosystem-explorer/src/features/home/components/hero-section.tsx Updates hero ornaments/gradients to use brand primitives.
ecosystem-explorer/src/features/home/components/explore-section.tsx Updates background ornament fill to use brand primitives.
ecosystem-explorer/src/features/collector/collector-page.tsx Updates gradient and “coming soon” accents to updated semantic tokens.
ecosystem-explorer/src/features/collector/collector-detail-page.tsx Updates loading and header ornament accents to updated primitives/tokens.
ecosystem-explorer/src/features/about/about-page.tsx Updates icon accent colors to updated semantic tokens.
ecosystem-explorer/src/components/ui/theme-toggle.tsx Adds a theme toggle button that cycles light → dark → auto.
ecosystem-explorer/src/components/ui/theme-toggle.test.tsx Adds tests for toggle cycling and data-theme updates.
ecosystem-explorer/src/components/ui/navigation-card.tsx Updates navigation card accents/gradients to updated primitives/tokens.
ecosystem-explorer/src/components/ui/glow-badge.tsx Updates primary variant styling to reflect the brand swap (now using secondary tokens).
ecosystem-explorer/src/components/ui/detail-card.tsx Updates hover accent styling to updated semantic tokens.
ecosystem-explorer/src/components/icons/pipeline-icon.tsx Updates icon stroke/fill colors to use brand primitives.
ecosystem-explorer/src/components/icons/otel-logo.tsx Updates logo colors to use brand primitives directly.
ecosystem-explorer/src/components/icons/java-instrumentation-icon.tsx Updates icon stroke/fill colors to use brand primitives.
ecosystem-explorer/src/components/icons/java-icon.tsx Updates icon stroke/fill colors to use brand primitives.
ecosystem-explorer/src/components/icons/configuration-icon.tsx Updates icon stroke/fill colors to use brand primitives.
ecosystem-explorer/src/components/icons/compass.tsx Updates icon stroke/fill colors to use brand primitives.
ecosystem-explorer/scripts/take-screenshots.mjs Updates screenshot automation to capture both dark and light via Playwright context colorScheme.
ecosystem-explorer/index.html Adds an early inline script to set data-theme before React loads.

Comment thread projects/84-ui-ux-design/NEXT-STEPS.md Outdated
Comment thread ecosystem-explorer/index.html Outdated
Comment thread ecosystem-explorer/src/components/ui/glow-badge.tsx
vitorvasc added 2 commits May 11, 2026 08:37
…so they render

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
@vitorvasc vitorvasc enabled auto-merge (squash) May 11, 2026 11:42
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
@vitorvasc
Copy link
Copy Markdown
Member Author

@jaydeluca screenshots are working now :) :)

I've pushed a fix to this branch so we capture images for both dark and light themes, but I'll update the comment template to show both of them in a separate PR.

Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
Signed-off-by: Vitor Vasconcellos <vvasconcellos1@gmail.com>
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants